package com.qc31.monitorlib.uitls

import autodispose2.autoDispose
import com.qc31.baselib.auto.AutoDisposeViewModel
import com.qc31.comlib.net.ServiceHelper

/** @Author pc_hfjs @Date 2022/6/7 11:35 @Desc */
class WxShareModel : AutoDisposeViewModel() {
    /** 分享定位信息 */
    fun shareLocation(carName: String, carId: String, addr: String = "") {
        ServiceHelper.getRepository().shareLocation(carId).autoDispose(this)
            .subscribe({
//                WxShareUtil.instance.shareWeb(
//                    "${AppContext.getDescById(R.string.desc_location_real)}   $carName",
//                    it.result.toString(),
//                    addr
//                )
            }, error)
    }

    /** 分享历史轨迹 */
    fun shareLine(
        carName: String, carId: String, stime: String, etime: String,
        filter0: String, filterInvalid: String, filterAppend: String,
        s_time: String, e_time: String
    ) {
        ServiceHelper.getRepository()
            .shareLine(carId, stime, etime, filter0, filterInvalid, filterAppend).autoDispose(this)
            .subscribe({

//                WxShareUtil.instance.shareWeb(
//                    "${AppContext.getDescById(R.string.title_monitor_history_line)}  $carName",
//                    it.result.toString(),
//                    "${AppContext.getDescById(R.string.desc_share_start)}:$s_time\n${
//                        AppContext.getDescById(
//                            R.string.desc_share_end
//                        )
//                    }:$e_time"
//                )
            }, error)
    }
}